﻿
<MudRTLProvider RightToLeft="@SharedLayoutSettings.IsRTL">
	<MudDialog DisableSidePadding="true">
		<DialogContent>
			<MudContainer MaxWidth="MaxWidth.Large" Style="max-height: 300px; overflow-y: scroll">
				<DashboardPageSection CodeFileName="@CodeFileName">
					@ChildContent
				</DashboardPageSection>
			</MudContainer>
		</DialogContent>
		<DialogActions>
			<MudButton Color="Color.Primary" OnClick="Close" Variant="Variant.Filled">@DashboardResource.StringCancel</MudButton>
		</DialogActions>
	</MudDialog>
</MudRTLProvider>

@code {

	[CascadingParameter]
	public MudDialogInstance MudDialog { get; set; }

	private void Close() => MudDialog.Close();

	// *****************************************************

	private RenderFragment ChildContent { get; set; }

	[Parameter] public Type Type { get; set; }

	[Parameter] public string CodeFileName { get; set; }

	protected override void OnParametersSet()
	{
		ChildContent = builder =>
			{
				builder.OpenComponent(0, Type);
				builder.CloseComponent();
			};
	}

}
